package com.spsoft.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spsoft.system.entity.BaseUser;
import com.spsoft.system.mapper.BaseUserMapper;
import com.spsoft.system.service.BaseUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * ??????? 服务实现类
 * </p>
 *
 * @author dingchengyun
 * @since 2023-10-26
 */
@Service
public class BaseUserServiceImpl extends ServiceImpl<BaseUserMapper, BaseUser> implements BaseUserService {


    @Override
    public BaseUser selectByUserCode(String userCode) {
        LambdaQueryWrapper<BaseUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BaseUser::getUserCode, userCode);
        return this.baseMapper.selectOne(wrapper);
    }

    @Override
    public Page<BaseUser> selectByName(String userName) {
        Page<BaseUser> p = new Page<>(1,4);
        LambdaQueryWrapper<BaseUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BaseUser::getOwnerDeptCode, "1031");
        Page<BaseUser> pr = baseMapper.selectPage(p,wrapper );
        return pr;
    }
}
